package com.ah.ajax_json;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import com.fasterxml.jackson.databind.ObjectMapper;
@WebServlet("/RegistCheckServlet")
public class RegistCheckServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		System.out.println("doGet");
		String username = request.getParameter("username");
		System.out.println("username = " + username);
		Map<String, Object> map = new HashMap<String, Object>();
		if ("a".equals(username)) {
			map.put("userExsit", true);
		} else {
			map.put("userExsit", false);
		}
		ObjectMapper mapper = new ObjectMapper();
		mapper.writeValue(response.getWriter(), map);
	}
}